<template>
  <div class="views" style="padding: 0; overflow: hidden" v-loading="loading">
    <iframe :src="src" style="width: 100%; height: 99.45%; background: #ffffff" frameborder="0"></iframe>
  </div>
</template>
<script>
import common from "./mixins/common";

export default {
  name: "homepage",
  data() {
    return {
      query: "billsAdminAll",
      src: "",
    };
  },
  mixins: [common],
  watch: {
    $route(newval) {
      if (newval.name == "homepage") {
        const id = newval.params.id;
        const approve = newval.params.approve;
        this.setSrc(id, approve);
      }
    },
  },
  created() {
    const id = this.$route.params.id;
    const approve = this.$route.params.approve;
    this.setSrc(id, approve);
  },
  beforeRouteUpdate(to, form, next) {
    console.log(to, form, this.$route, "beforeRouteUpdate");
  },
  methods: {
    setSrc(id, approve) {
      if (id && approve) {
        this.src = `${this.url}?appKey=${this.getTokenParams.appKey}&credentialId=${this.getTokenParams.credentialId}&userId=${this.getTokenParams.userId}&customerId=${this.getTokenParams.customerId}&appSecret=${this.getTokenParams.appSecret}&query=${this.query}&random=${this.random}&id=${id}&approve=${approve}`;
      } else {
        this.src = `${this.url}?appKey=${this.getTokenParams.appKey}&credentialId=${this.getTokenParams.credentialId}&userId=${this.getTokenParams.userId}&customerId=${this.getTokenParams.customerId}&appSecret=${this.getTokenParams.appSecret}&query=${this.query}&random=${this.random}`;
      }
    },
  },
};
</script>
<style lang="less"></style>
